package com.jerry.controller;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import java.util.Map;

/**
 * Created by Shirly on 2016/9/1.
 */
public class ContextRefreshedListener implements ApplicationListener<ContextRefreshedEvent> {
    public void onApplicationEvent(ContextRefreshedEvent event) {
        // 根容器为Spring容器
        if(event.getApplicationContext().getParent()==null){
           // Map<String,Object> beans = event.getApplicationContext().getBeansWithAnnotation("wd");
//            for(Object bean:beans.values()){
//                System.err.println(bean==null?"null":bean.getClass().getName());
//            }
//            System.err.println("=====ContextRefreshedEvent====="+event.getSource().getClass().getName());
       }
    }
}
